﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/masDefault.master" AutoEventWireup="true"
    CodeFile="SubCategory.aspx.cs" Inherits="WebTeamplate.Admin_SubCategory" %>

<%@ Register Assembly="Control" Namespace="PagerControl" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ctMain" runat="Server">
    <div class="ui-state-default ui-corner-top ui-box-header">
        <span class="ui-icon float-left ui-icon-notice"></span>Tìm kiếm
    </div>
    <div class="content-box-wrapper">
        <br />
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
         <tr class="row">
                <td  class="labelRight">
                    <asp:Label ID="lblLanguage" runat="server" Text="Ngôn ngữ">
                    </asp:Label>
                    :
                </td>
                <td  class="labelLeft">
                    <asp:DropDownList ID="drlLanguage" runat="server" CssClass="drp adminControl" 
                        AutoPostBack="True" onselectedindexchanged="drlLanguage_SelectedIndexChanged1">
                    </asp:DropDownList>
                </td>
                <td>
                </td>
            </tr>
            <tr class="row">
                <td style="width: 170px;" class="labelRight">
                    <asp:Label ID="lblCategory" runat="server" Text="Nhóm danh mục">
                    </asp:Label>
                   :
                </td>
                <td style="width: 240px;" class="labelLeft">
                    <asp:DropDownList ID="F_drlCategory" runat="server" CssClass="drp adminControl">
                    </asp:DropDownList>
                </td>
                <td>
                </td>
            </tr>
            <tr class="row">
                <td class="labelRight">
                    <asp:Label ID="lblName" runat="server" Text="Tên danh mục">
                    </asp:Label>
                    :
                </td>
                <td class="labelLeft">
                    <asp:TextBox ID="F_txtName" CssClass="txt adminControl" runat="server" Width="200px">
                    </asp:TextBox>
                </td>
                <td>
                </td>
            </tr>
            <tr class="row">
                <td class="labelRight">
                    Tình trạng:
                </td>
                <td class="labelLeft">
                    <asp:RadioButtonList ID="F_rblStatus" runat="server" RepeatColumns="3" meta:resourcekey="rblStatusResource1">
                    </asp:RadioButtonList>
                </td>
                <td>
                </td>
            </tr>
            <tr >
                <td align="right">
                </td>
                <td align="left">
                    <asp:Button ID="btnSearch" runat="server" Text="Lưu" CssClass="ui-state-default ui-corner-all ui-state-focus"
                        OnClick="btnSearch_Click" />
                    <asp:Button ID="btnReset" OnClientClick="return Reset();" runat="server" Text="Làm lại"
                        CssClass="ui-state-default ui-corner-all ui-state-focus" />
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <table class="noneborder" style="width: 100%;">
        <tr>
            <td>
                <asp:Button ID="btnDelete" runat="server" CssClass="ui-state-default ui-corner-all ui-state-focus"
                    OnClientClick="return CheckDelete();" OnClick="btnDelete_Click" />
                <asp:Button ID="btnAddNew" runat="server" CssClass="ui-state-default ui-corner-all ui-state-focus"
                    OnClick="btnAddNew_Click" />
            </td>
            <td align="right" width="500px">
                <cc1:Pager ID="pagerTop" runat="server" OnPageIndexChanging="pagerTop_PageIndexChanging"
                    OnPageSizeChanging="pagerTop_PageSizeChanging" />
                
            </td>
        </tr>
    </table>
    <div class="hastable">
        <table cellspacing="0">
            <asp:Repeater ID="rptData" runat="server" OnItemDataBound="rptData_ItemDataBound"
                OnItemCommand="rptData_ItemCommand">
                <HeaderTemplate>
                    <thead>
                        <tr>
                            <td style="width: 30px">
                                <input id="chkCheckAll" name="chkCheckAll" onclick='ChekAll(this.checked)' type="checkbox">
                            </td>
                            <td style="width: 30px">
                                <%=Resources.Resource.RowHeaderNo%>
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtnName" CssClass="headerLink" runat="server" CommandName="SortOrder"
                                    CommandArgument="subCategoryName" Text="Tên danh mục">                         
                                </asp:LinkButton>
                            </td>
                            <td style="width: 50px">
                                <%=Resources.Resource.RowHeaderSortOrder%>
                            </td>
                            <td style="width: 50px">
                                <%=Resources.Resource.RowHeaderPublish%>
                            </td>
                            <td style="width: 90px">
                            </td>
                        </tr>
                    </thead>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td class="repeaterCenterData">
                            <input type="checkbox" name="chk_<%#Eval("SubCategoryId") %>" id="chk_<%#Eval("SubCategoryId") %>"
                                onclick="CheckItem('<%#Eval("SubCategoryId") %>',this.checked);" />
                        </td>
                        <td class="repeaterCenterData">
                            <asp:Literal ID="ltrNo" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterLeftData">
                            <asp:Literal ID="ltrSubName" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterCenterData">
                            <asp:ImageButton ID="imgOrderDown" runat="server" ImageUrl="~/App_Themes/Admin/images/tick.png"
                                CommandName="OrderDown" />
                            <asp:ImageButton ID="imgOrderUp" runat="server" ImageUrl="~/App_Themes/Admin/images/tick.png"
                                CommandName="OrderUp" />
                        </td>
                        <td class="repeaterCenterData">
                            <asp:ImageButton ID="btnPublish" runat="server" ImageUrl="~/App_Themes/Admin/images/tick.png"
                                CommandName="publish" />
                        </td>
                        <td class="repeaterCenterData">
                            <asp:HyperLink ID="hplEdit" Text="Edit" runat="server"></asp:HyperLink>
                            |
                            <asp:LinkButton ID="lbtnDelete" runat="server" Text="Delete" CommandName="delete"
                                OnClientClick="return ConfirmDelete();"></asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
                <AlternatingItemTemplate>
                    <tr class="alt">
                        <td class="repeaterCenterData">
                            <input type="checkbox" name="chk_<%#Eval("SubCategoryId") %>" id="chk_<%#Eval("SubCategoryId") %>"
                                onclick="CheckItem('<%#Eval("SubCategoryId") %>',this.checked);" />
                        </td>
                        <td class="repeaterCenterData">
                            <asp:Literal ID="ltrNo" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterLeftData">
                            <asp:Literal ID="ltrSubName" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterCenterData">
                            <asp:ImageButton ID="imgOrderDown" runat="server" ImageUrl="~/App_Themes/Admin/images/tick.png"
                                CommandName="OrderDown" />
                            <asp:ImageButton ID="imgOrderUp" runat="server" ImageUrl="~/App_Themes/Admin/images/tick.png"
                                CommandName="OrderUp" />
                        </td>
                        <td class="repeaterCenterData">
                            <asp:ImageButton ID="btnPublish" runat="server" ImageUrl="~/App_Themes/Admin/images/tick.png"
                                CommandName="publish" />
                        </td>
                        <td class="repeaterCenterData">
                            <asp:HyperLink ID="hplEdit" Text="Edit" runat="server"></asp:HyperLink>
                            |
                            <asp:LinkButton ID="lbtnDelete" runat="server" Text="Delete" CommandName="delete"
                                OnClientClick="return ConfirmDelete();"></asp:LinkButton>
                        </td>
                    </tr>
                </AlternatingItemTemplate>
            </asp:Repeater>
        </table>
       <%-- <table cellspacing="0">
            
                    <thead>
                        <tr>
                            <td style="width: 30px;">
                                <input type="checkbox" onclick="ChekAll(this.checked)" name="chkCheckAll" id="chkCheckAll">
                            </td>
                            <td style="width: 30px;">
                                STT
                            </td>
                            <td>
                                <a href="javascript:__doPostBack('ctl00$ctMain$rptData$ctl00$lbtnName','')" class="headerLink" id="ctl00_ctMain_rptData_ctl00_lbtnName">Tên danh mục</a>
                            </td>
                            <td style="width: 50px;">
                                Thứ tự
                            </td>
                            <td style="width: 50px;">
                                Kích hoạt
                            </td>
                            <td style="width: 90px;">
                            </td>
                        </tr>
                    </thead>
                
                    <tbody><tr>
                        <td class="repeaterCenterData">
                            <input type="checkbox" onclick="CheckItem('55561',this.checked);" id="chk_55561" name="chk_55561">
                        </td>
                        <td class="repeaterCenterData">
                            1
                        </td>
                        <td class="repeaterLeftData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55561&amp;act=edit">SGD</a>
                        </td>
                        <td class="repeaterCenterData">
                            
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/downarrow.png" title="Order up" id="ctl00_ctMain_rptData_ctl01_imgOrderUp" name="ctl00$ctMain$rptData$ctl01$imgOrderUp">
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/tick.png" id="ctl00_ctMain_rptData_ctl01_btnPublish" name="ctl00$ctMain$rptData$ctl01$btnPublish">
                        </td>
                        <td class="repeaterCenterData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55561&amp;act=edit" id="ctl00_ctMain_rptData_ctl01_hplEdit">Cập nhật</a>
                            |
                            <a href="javascript:__doPostBack('ctl00$ctMain$rptData$ctl01$lbtnDelete','')" id="ctl00_ctMain_rptData_ctl01_lbtnDelete" onclick="return ConfirmDelete();">Xóa</a>
                        </td>
                    </tr>
                
                    <tr class="alt">
                        <td class="repeaterCenterData">
                            <input type="checkbox" onclick="CheckItem('55562',this.checked);" id="chk_55562" name="chk_55562">
                        </td>
                        <td class="repeaterCenterData">
                            2
                        </td>
                        <td class="repeaterLeftData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55562&amp;act=edit">USD</a>
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/uparrow.png" title="Order down" id="ctl00_ctMain_rptData_ctl02_imgOrderDown" name="ctl00$ctMain$rptData$ctl02$imgOrderDown">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/downarrow.png" title="Order up" id="ctl00_ctMain_rptData_ctl02_imgOrderUp" name="ctl00$ctMain$rptData$ctl02$imgOrderUp">
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/tick.png" id="ctl00_ctMain_rptData_ctl02_btnPublish" name="ctl00$ctMain$rptData$ctl02$btnPublish">
                        </td>
                        <td class="repeaterCenterData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55562&amp;act=edit" id="ctl00_ctMain_rptData_ctl02_hplEdit">Cập nhật</a>
                            |
                            <a href="javascript:__doPostBack('ctl00$ctMain$rptData$ctl02$lbtnDelete','')" id="ctl00_ctMain_rptData_ctl02_lbtnDelete" onclick="return ConfirmDelete();">Xóa</a>
                        </td>
                    </tr>
                
                    <tr>
                        <td class="repeaterCenterData">
                            <input type="checkbox" onclick="CheckItem('55563',this.checked);" id="chk_55563" name="chk_55563">
                        </td>
                        <td class="repeaterCenterData">
                            3
                        </td>
                        <td class="repeaterLeftData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55563&amp;act=edit">RUP</a>
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/uparrow.png" title="Order down" id="ctl00_ctMain_rptData_ctl03_imgOrderDown" name="ctl00$ctMain$rptData$ctl03$imgOrderDown">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/downarrow.png" title="Order up" id="ctl00_ctMain_rptData_ctl03_imgOrderUp" name="ctl00$ctMain$rptData$ctl03$imgOrderUp">
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/tick.png" id="ctl00_ctMain_rptData_ctl03_btnPublish" name="ctl00$ctMain$rptData$ctl03$btnPublish">
                        </td>
                        <td class="repeaterCenterData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55563&amp;act=edit" id="ctl00_ctMain_rptData_ctl03_hplEdit">Cập nhật</a>
                            |
                            <a href="javascript:__doPostBack('ctl00$ctMain$rptData$ctl03$lbtnDelete','')" id="ctl00_ctMain_rptData_ctl03_lbtnDelete" onclick="return ConfirmDelete();">Xóa</a>
                        </td>
                    </tr>
                
                    <tr class="alt">
                        <td class="repeaterCenterData">
                            <input type="checkbox" onclick="CheckItem('55564',this.checked);" id="chk_55564" name="chk_55564">
                        </td>
                        <td class="repeaterCenterData">
                            4
                        </td>
                        <td class="repeaterLeftData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55564&amp;act=edit">LIA</a>
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/uparrow.png" title="Order down" id="ctl00_ctMain_rptData_ctl04_imgOrderDown" name="ctl00$ctMain$rptData$ctl04$imgOrderDown">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/downarrow.png" title="Order up" id="ctl00_ctMain_rptData_ctl04_imgOrderUp" name="ctl00$ctMain$rptData$ctl04$imgOrderUp">
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/tick.png" id="ctl00_ctMain_rptData_ctl04_btnPublish" name="ctl00$ctMain$rptData$ctl04$btnPublish">
                        </td>
                        <td class="repeaterCenterData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55564&amp;act=edit" id="ctl00_ctMain_rptData_ctl04_hplEdit">Cập nhật</a>
                            |
                            <a href="javascript:__doPostBack('ctl00$ctMain$rptData$ctl04$lbtnDelete','')" id="ctl00_ctMain_rptData_ctl04_lbtnDelete" onclick="return ConfirmDelete();">Xóa</a>
                        </td>
                    </tr>
                
                    <tr>
                        <td class="repeaterCenterData">
                            <input type="checkbox" onclick="CheckItem('55570',this.checked);" id="chk_55570" name="chk_55570">
                        </td>
                        <td class="repeaterCenterData">
                            5
                        </td>
                        <td class="repeaterLeftData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55570&amp;act=edit">Test2</a>
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/uparrow.png" title="Order down" id="ctl00_ctMain_rptData_ctl05_imgOrderDown" name="ctl00$ctMain$rptData$ctl05$imgOrderDown">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/downarrow.png" title="Order up" id="ctl00_ctMain_rptData_ctl05_imgOrderUp" name="ctl00$ctMain$rptData$ctl05$imgOrderUp">
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/tick.png" id="ctl00_ctMain_rptData_ctl05_btnPublish" name="ctl00$ctMain$rptData$ctl05$btnPublish">
                        </td>
                        <td class="repeaterCenterData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55570&amp;act=edit" id="ctl00_ctMain_rptData_ctl05_hplEdit">Cập nhật</a>
                            |
                            <a href="javascript:__doPostBack('ctl00$ctMain$rptData$ctl05$lbtnDelete','')" id="ctl00_ctMain_rptData_ctl05_lbtnDelete" onclick="return ConfirmDelete();">Xóa</a>
                        </td>
                    </tr>
                
                    <tr class="alt">
                        <td class="repeaterCenterData">
                            <input type="checkbox" onclick="CheckItem('55571',this.checked);" id="chk_55571" name="chk_55571">
                        </td>
                        <td class="repeaterCenterData">
                            6
                        </td>
                        <td class="repeaterLeftData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55571&amp;act=edit">Test3</a>
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/uparrow.png" title="Order down" id="ctl00_ctMain_rptData_ctl06_imgOrderDown" name="ctl00$ctMain$rptData$ctl06$imgOrderDown">
                            
                        </td>
                        <td class="repeaterCenterData">
                            <input type="image" style="border-width: 0px;" src="../App_Themes/Admin/images/tick.png" id="ctl00_ctMain_rptData_ctl06_btnPublish" name="ctl00$ctMain$rptData$ctl06$btnPublish">
                        </td>
                        <td class="repeaterCenterData">
                            <a href="SubCategoryDetail.aspx?F_PageIndex=1&amp;F_PageSize=20&amp;F_SortExpression=ASC&amp;F_SortField=%5bOrder%5d&amp;subcategoryId=55571&amp;act=edit" id="ctl00_ctMain_rptData_ctl06_hplEdit">Cập nhật</a>
                            |
                            <a href="javascript:__doPostBack('ctl00$ctMain$rptData$ctl06$lbtnDelete','')" id="ctl00_ctMain_rptData_ctl06_lbtnDelete" onclick="return ConfirmDelete();">Xóa</a>
                        </td>
                    </tr>
                
        </tbody></table>--%>
    </div>
    <table class="noneborder" style="width: 100%;">
        <tr>
            <td>
                &nbsp;
            </td>
            <td align="right" width="500px">
                <%--<cc1:pager id="pagerBottom" runat="server" onpageindexchanging="pagerBottom_PageIndexChanging"
                    onpagesizechanging="pagerBottom_PageSizeChanging" />--%>
                    <cc1:Pager ID="pagerBottom" runat="server" OnPageIndexChanging="pagerTop_PageIndexChanging"
                    OnPageSizeChanging="pagerTop_PageSizeChanging" />
            </td>
        </tr>
    </table>
    <input type="hidden" id="hidListId" runat="server" value="" />
    <input type="hidden" id="hidListIdSelect" runat="server" value="" />

    <script type="text/javascript">

        function Reset() {
            document.getElementById('<%=F_drlCategory.ClientID %>').value = '';
            document.getElementById('<%=F_txtName.ClientID %>').value = '';
            SetValueForRadioButtonList('<%=F_rblStatus.ClientID %>', '');
            return false;
        }
        // return the value of the radio button that is checked
        function ConfirmDelete() {
            var yes = confirm('<%=Resources.Resource.ConfirmDelete %>');
            return yes;
        }
        function CheckDelete() {
            var id = document.getElementById('<%=hidListIdSelect.ClientID %>').value;
            if (id == '') {
                alert('<%=Resources.Resource.RequireSelect %>');
                return false;
            }
            else return ConfirmDelete();

        }
        function CheckItem(id, status) {

            var idSelect = document.getElementById('<%=hidListIdSelect.ClientID %>').value;
            if (status) {
                idSelect += id + ';';
            }
            else idSelect = idSelect.replace(id + ';', '');
            if (idSelect.length == document.getElementById('<%=hidListId.ClientID %>').value.length) {
                document.getElementById('chkCheckAll').checked = true;
            }
            else
                document.getElementById('chkCheckAll').checked = false;
            document.getElementById('<%=hidListIdSelect.ClientID %>').value = idSelect;
        }
        function ChekAll(status) {

            var id = document.getElementById('<%=hidListId.ClientID %>').value;
            var arr = new Array();
            arr = id.split(';');
            if (arr.length > 0) {
                for (var i = 0; i < arr.length; i++) {
                    if (document.getElementById('chk_' + arr[i].toString())) {
                        document.getElementById('chk_' + arr[i].toString()).checked = status;

                    }
                }

            }
            if (status) {
                document.getElementById('<%=hidListIdSelect.ClientID %>').value = id;
            }
            else document.getElementById('<%=hidListIdSelect.ClientID %>').value = '';
        }
       
    </script>

</asp:Content>
